#include<bits/stdc++.h>
using namespace std;
long long n,m,k,i,j,ans;
char a1[200005],a2[200005],b[200005],c[200005];
int main()
{
	freopen("replace.in","r",stdin);
	freopen("replace.out","w",stdout);
	cin>>n>>m;
	for(long long i=1;i<=n;i++)
	{
		cin>>a1>>a2;
	}
	for(long long i=1;i<=m;i++)
	{
		cin>>b>>c;
		cout<<"0"<<endl;
	}
	return 0;
}
